home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
HEDIT2_2.ARJ
/
HEDIT.DOC
next >
Wrap
Text File
|
1992-07-22
|
27KB
|
631 lines
HEDIT
DOS File Editor
Version 2.2
Copyright 1991,1992 by Larry Michaels
Table of Contents
INTRODUCTION...................................1
SHAREWARE NOTICE...............................1
REGISTRATION FORM..............................2
NOTES ON USING HEDIT...........................3
FILES........................................3
CHANGING FILE READ/WRITE MODE................3
CHANGING FILE HIDDEN ATTRIBUTE...............4
EDITING ANOTHER FILE.........................4
IMPORTING FILES..............................4
DISPLAYING THE DIRECTORY.....................4
CONFIGURATION FILE...........................4
SCREEN LAYOUT................................5
EDITING......................................5
CURSOR MOVEMENT..............................5
SEARCH AND REPLACE...........................6
BLOCK OPERATIONS.............................6
PRINTING.....................................7
FILE TRUNCATION..............................7
REPEAT CHANGE................................7
BYTE TRANSLATION.............................7
SETTING BYTES IN A BLOCK.....................8
MACROS.......................................8
UNDO.........................................8
SCREEN ATTRIBUTES............................8
HELP.........................................8
DOS SHELL....................................8
LIST OF HEDIT COMMANDS..........................9
1
INTRODUCTION
HEDIT is a powerful, easy to use editor with which you can create,
view, and edit DOS files in both hex and ASCII formats. I wrote
HEDIT to fill a need which I often have to be able to create and
edit binary files such as the input and output files for other
applications which I am developing. I have included some special
features such as the ability to set read/write and hidden attributes,
jump to any file offset, search for/replace strings in both hex and
ASCII formats, insert the contents of another file into the file being
edited, truncate the file after the cursor, and set all bytes in a
selected field to a certain value, to facilitate specific tasks which
frequently need to be done.
I hope that you will try out HEDIT, and find it usefull. I am
anxious to receive comments and suggestions from users. Version
2.2 includes a few new features not in version 2.1, as well as a few
bug fixes. This document describes HEDIT's features. While running
HEDIT, help can be obtained by pressing F1.
SHAREWARE NOTICE
HEDIT is SHAREWARE software. This means that you are free to try
it out for 30 days to decide whether or not you wish to use it.
If you decide to use it, you are urged to please send a very modest
$16 US registration fee, along with any comments or suggestions you
may have. Your registration will inform me that you are using my
software, and help pay my rent. Registration includes a disk with
a personalized version of the latest release. Software development
is my only source of income, so your cooperation in registering will
be greatly appreciated. A registration form is included in this
document, and can also be printed out by pressing 'P' from the
startup screen.
You are free (and encouraged) to distribute HEDIT to friends,
co-workers, neighbors, etc. with the following conditions:
- This file (HEDIT.DOC) is included, and the files are left as they
are without any modifications,
- If any fee is charged, it should be minimal,
- The recipients know, or are informed about, the shareware concept.
I have made a sincere effort to remove all bugs from this software.
If any bugs are found however, I apologize and request that they be
brought to my attention. No warranty, either explicit or implied
is (or can be) made on this software. I assume no financial
responsibilty for any loss of data, time, profits, or other damages
resulting from the use (or misuse) of HEDIT.
Thank you for trying HEDIT; I hope that you will find it useful.
Larry Michaels
P.O. Box 59379
Chicago, IL 60659 U.S.A.
A registration form can be printed by pressing 'P' from the startup
screen. A copy of the form is also included on the following page.
INVOICE FOR HEDIT VER 2.2
Remit to: From:
Larry Michaels _______________________________
P.O. Box 59379
Chicago, IL 60659 _______________________________
_______________________________
_______________________________
_______________________________
_______________________________
Phone:_________________________
Where did you get your copy of HEDIT? __________________________
Registration $16US per user Quantity:____ x $16 = ___________
IL residents add 7% sales tax: ___________
Total: ___________
Check if you require a 3.5" disk:____
Comments:
3
NOTES ON USING HEDIT
FILES
HEDIT will accept any file which can be opened and read by DOS. The
file name may be supplied on the command line. If no file name or an
invalid file name is specified, the file "NONAME.###" will be created
(or opened, if it already exists). If a non-existent file is
specified, a new file will be created. For files which do not have
write permission, HEDIT will display the file, but will not accept
any commands to alter it. On the top line, the words "READ ONLY" will
appear. The read/write mode of the file can be changed to allow
editing using the Change File Mode command described later.
For files which are not read-only, HEDIT automatically creates a
backup file upon startup. All changes are made to the backup file,
and the original file is not altered until the user presses a save
key (Alt S or Alt Z). If HEDIT detects upon startup that there is
not enough disk space to create a backup file, it will open the file
in read-only mode.
The backup file is given the same name as the original file with the
file extension ".BAK". If the original file has the extension ".BAK"
the backup file is given the extension ".BAC".
During an edit session, HEDIT may create a temporary storage file
with the same name as the original file and the extension ".$@!".
This file is automatically deleted upon exit. If HEDIT runs out of
disk space during a disk write, the user will be informed, and the
results may be unpredictable. The user should make sure that there is
at least enough free disk space to accommodate a backup file of the
same size as the original plus a temporary file of about 120 Kbytes.
Large block operations will require more disk sapce.
To save the file (ie. update the original file) without leaving
HEDIT, Alt S is used. Alt Z will save the file and exit. Alt A
will save the file under a new name provided by the user.
HEDIT may be exited without affecting the original file (providing
that Alt S has not been pressed already) by pressing Alt X. If any
changes have been made during the editing session (or since the last
save), the user will be prompted whether or not those changes should
be abandoned. Pressing "Y", will cause HEDIT to close without
saving, while "N" will cause the file to be updated. ESCAPE will
cancel the request.
CHANGING FILE READ/WRITE MODE
As mentioned, HEDIT will open both files with read-write and
read-only permission. The user may change the read/write permission
mode of the file by pressing Alt M and selecting the desired file
mode. A read-only file which is changed to read-write will be changed
immediately to read-write, a backup file will be created, and
modifications will then be allowed. A file with read-write permission
which is changed to read-only will not actually be changed until one
of the save commands are issued by the user. Therefore, changes to the
file will still be allowed until the file is saved.
4
CHANGING FILE HIDDEN ATTRIBUTE
HEDIT provides the facility to set the hidden attribute bit of the
file being edited. Files with their hidden attribute bit set will not
be listed by the DOS DIR command nor by many other applications. The
user may set this attribute by pressing Alt H. When the file's
hidden attribute is changed, HEDIT will indicate the change on the top
line by placing parentheses around the file name (for hidden files),
or by removing the parentheses.
EDITING ANOTHER FILE
At any time, the user can switch to a different file for editing by
pressing Alt E. If changes have been made to the current file since
the last save, the user will be prompted as to whether or not the
changes should be abandoned. The user will then be prompted to enter
a file name. If a valid file name is entered, the current file will
be closed, the specified new file will be opened (or created), and
editing will proceed with the new file.
IMPORTING FILES
HEDIT can insert the contents of any file into the file currently
being edited. When Alt I is pressed, the user will be prompted for
the name of the file to import. The contents of that file will be
inserted in the current file, starting at the current offset.
DISPLAYING THE DIRECTORY
Whenever the user is in a file name prompt field (import file,
save as, edit another file), the contents of the directory can be
displayed by either pressing F7, or by entering a path name on the
prompt line and pressing ENTER. Disk drive specifiers can be
included in the path. Up to about 4500 files per directory can
be displayed. The names of hidden files and directories (ie.
those which have their hidden attribute bit set) are displayed
enclosed in parentheses. The upper left corner of the directory
screen shows the current drive and directory.
While viewing the directory, the arrow keys, PgUp, PgDn, Ctrl PgUp,
and Ctrl PgDn are be used to move around the directory. The TAB key
is used to toggle between the directory display and the prompt line.
By entering a different path on the prompt line, a different
directory can be displayed. The currently selected file can be
deleted by pressing DELETE.
CONFIGURATION FILE
HEDIT reads and writes a startup file named HEDIT.CFG. This file
stores the screen attributes, printer setup parameters, byte
translation table, and macro definitions. Upon startup, HEDIT looks
in the current directory for this file and if it is not found there,
it searches the DOS path for it. If the file is still not found,
default values are used. Upon exit, HEDIT updates this file if any
configuration changes have been made, or creates a new file if none
already exists.
5
SCREEN LAYOUT
The HEDIT screen is broken into three main sections. The top line
displays the name of the file being edited on the left side, and the
Insert/Overtype mode on the right. If the file's hidden attribute bit
is set, the file name will appear enclosed in parentheses. The bottom
line normally displays the file offset of the byte at which the cursor
is positioned. This line is also used to prompt the user for
information and to display messages.
The main part of the screen is broken into three columns. On the
left of each row is displayed the file offset of the first byte on
that line. In the middle are the hex representations of up to 16
bytes, while on the right, the ASCII character repesentations of
the same bytes are displayed. The cursor may be positioned on any
byte in either the hex of ASCII fields. The cursor can be toggled
between fields by pressing ALT T.
EDITING
The actions taken upon a keystroke depend on the current location of
the cursor and the Insert/Overtype mode. When the Insert mode is set
and the cursor is in the hex portion of the screen, only they keys
0-9, a-f (besides control keys) are accepted. If the cursor is on
the upper nibble of a byte, a new byte will be inserted with the
lower nibble the same as the original byte and the upper nibble
depending on the key pressed. The cursor will then be positioned at
the lower nibble of the new byte. The next keystroke will set the
lower nibble of that byte. If the cursor is on the lower nibble of
a byte when a key is pressed, a new byte will be inserted with the
upper nibble the same as the original byte, and the lower nibble
depending on the key pressed. In Overtype mode, the nibble at which
the cursor is positioned will be overwritten.
If the cursor is in the ASCII field when a key is pressed, a new byte
will be inserted at the current position. Any byte value (0-255) will
be accepted in this field. In Overtype mode, the current nibble or
byte will be overwritten with the new one.
The Insert/Overtype mode can be toggled by pressing the INSERT key, and
is displayed on the top line of the screen.
In Insert mode, pressing the DELETE key will cause the current byte to
be deleted. In the hex field, BACKSPACE will cause the previous byte
to be deleted. In the ASCII field however, since Backspace is a valid
ASCII byte, pressing BACKSPACE will cause a backspace byte (08h) to be
inserted. To backspace in the ASCII field, Shift BACKSPACE is used.
CURSOR MOVEMENT
The arrow keys move the cursor one byte, nibble, or line at a time.
Page Up and Page Down will position the cursor one page up or down.
Ctrl Pg Up moves to the beginning of the file and Ctrl Pg Dn moves to
the end of the file. The Home key causes the cursor to be positioned
on the first byte on the current line, while the End key positions the
cursor at the last byte on the line. Alt T toggles the cursor between
the hex and ASCII fields.
6
The right and left arrow keys, used with Ctrl, cause the cursor to
jump up or down a number of bytes. The size of the jump is set by
pressing Alt N, and entering the desired number (in decimal). Every
time Ctrl Right Arrow or Ctrl Left Arrow are pressed, the cursor will
jump up or down the number of bytes set.
SEARCH AND REPLACE
HEDIT allows the user to jump to any given file offset or search for
a string of bytes. Strings may also be replaced one at a time or
globally.
To go to a particular byte offset, Alt G is used. The user will be
prompted for an offset value which must be given in hex. Preceeding
zeroes need not be entered. Pressing ESCAPE while in the will prompt
field will cancel the operation while ENTER will execute the operation.
Strings for search and replace may be specified in either hex or ASCII.
To specify a search string in hex, the F2 key is used, while Alt F2
is used for ASCII. The keys F3 (hex) and Alt F3 (ASCII) request
search and replace. When entering a string in ASCII format, to escape,
backspace, or execute, Shift ESCAPE, Shift BACKSPACE, and Shift ENTER
resectively must be used since the ESCAPE, BACKSPACE, and ENTER keys
produce valid bytes which will be included in the strings.
After a match of the search string has been found, the next or
previous matches may be found by pressing F4 or Ctrl F4 respectively.
HEDIT will also search the file to count the number of occurrences
of a string. The keys F9 (hex) and Alt F9 (ASCII) are used. This
function works much the same way as a global string replace, except
that occurrences of the string are counted, but not replaced.
For all string search and replace functions, searching begins at the
current offset and proceeds in the forward direction. To search the
file before the current offset Ctrl F4 (find previous) is used.
Whenever the current offset lies within a selected block when a search
is initiated, the user will be prompted whether the entire file should
be searched, or only the block. If the user selects the block only
option, further F4 (find next) commands will only cause the blocked
part of the file to be searched.
BLOCK OPERATIONS
Any section of the file may be blocked. Blocks may be created and
resized using Alt B, or by using the cursor control keys while holding
the Shift key. To copy a block into the block buffer Alt C is used.
Shift DELETE will cause the block to be deleted and copied into the
block buffer. To remove the block highlight (unblock), Alt R is used.
Once a block has been copied or deleted, Shift INSERT will cause the
block to be inserted at the current offset.
7
PRINTING
HEDIT can print all or part of the file being edited. Alt P causes
the entire file be printed, while ALT L prints only the blocked bytes.
The file is printed in the same format as is displayed on the screen
with the exception that bytes with values below 20h and above 7fh are
replaced with space characters in the ASCII field to avoid confusing
the printer.
The printer port, lines per page, and end of page character can be set
by pressing ALT O. These values are stored in the startup file
HEDIT.CFG, and read upon startup.
FILE TRUNCATION
HEDIT provides a fast and simple way of truncating a file. By
pressing F10, the file will be truncated following the cursor (ie.
the current byte will become the last byte of the file).
REPEAT CHANGE
Single-byte changes can be repeated an indefinite number of times by
pressing F8. In Insert mode, the last byte inserted or changed (ie.
the new value) will be inserted at the current cursor position. In
Overtype mode, the current byte will be changed to the value of the
last changed or inserted byte. This feature is useful for entering
multiple instances of special bytes which can not otherwise be
produced with a single keystroke, such as those entered using the
numeric keypad with Alt.
BYTE TRANSLATION
HEDIT provides a simple byte translation feature. A table of up to
64 byte translation pairs is stored. When the translation function
is executed, every byte in the file or the selected block whose value
is listed in the table is replaced by the corresponding translation
value from the table.
The translation table can be edited by pressing Alt F8. The fields
to the left of the arrows (->) are filled with the values (in hex)
which are to be changed, while fields to the right of the arrows are
filled with the corresponding hex values to which the bytes are to
be changed. For example, if the entry "25->36" is entered in the
table, when the translate function is executed, all bytes in the
file or block which have the value 25h will be automatically changed
to 36h. The arrow keys are used to move around the table. Pressing R
while in the table will reset all of the byte pairs so that the
translation function will have no effect. Enter or Esc are used to
exit the table and return to the edit screen. All changes made to
the table are automatically saved to the configuration file upon
exiting the program.
The translate function is executed by pressing Ctrl F8. If there is
a block selected anywhere in the file, the user will be prompted
whether only the bytes in the selected block, or all the bytes in the
8
file (starting from the beginning) should be translated. If there
is not a slected block, the user will be prompted whether or not the
translation should proceed. Pressing Esc at either of these prompts
will cancel the request. Translation cannot be undone.
SETTING BYTES IN A BLOCK
HEDIT provides a feature which sets all bytes within a selected block
to a given value. If a block is selected, pressing F11 or Alt F11
will cause HEDIT to prompt for the value to which the bytes in the
block are to be set. F11 is used to specify the value in hex, while
Alt F11 is used to specify the value in ASCII. This action cannot be
undone.
MACROS
Up to 10 macros can be recorded, each macro having up to 150
keystrokes. Macro recorded is begun by pressing Alt Q, and then
entering a number between 0 and 9. The message "Recording Macro"
will appear on the bottom line to indicate that keystrokes are
being recorded. All keystrokes entered, up to 150, will be recorded,
except the Help key (F1), and any keys pressed while in a help
screen. Macro recording is terminated by pressing Alt Q again. If
more than 150 keys are pressed, or the Edit Another File key (Alt E)
is pressed, macro recording will terminate. The keys Alt 0 through
Alt 9 are used to play back the macros. Recorded macros are saved
to the configuration file upon exiting the program.
UNDO
Pressing Alt U will cause the last change to be undone. This works
for single byte changes as well as replaces and block insertions and
deletions. It does not work for the set bytes or translate actions.
SCREEN ATTRIBUTES
The screen attributes may be changed by pressing F5 (foreground) and
F6 (background). The foreground and background attributes of the
top and bottom lines (and help screens) are changed with Alt F5 and
Alt F6.
HELP
Help screens can be displayed by pressing F1.
DOS SHELL
A DOS shell may be opened by pressing Alt D. Typing "ESCAPE" at the
DOS prompt while in the shell will return control to HEDIT. Be
careful not to alter the file being edited, the backup file, or the
temporary file ("xxx.$@!") while in the DOS shell as the results will
be unpredictable.
9
The following is a list of HEDIT commands:
Change Scrn FG color F5 Changes the foreground color of the screen.
Change Scrn BG color F6 Changes the background color of the screen.
Change Scrn FG color Alt F5 Changes the foreground color of lines 1&25.
Change Scrn BG color Alt F6 Changes the background color of lines 1&25.
Configure Printer Alt O Allows printer parameters to be set.
Copy Block Alt C Copies the selected block to the block buffer.
Count Occurrs (ASCII) Alt F9 Counts the # of occurrences of an ASCII str.
Count Occurrs (hex) F9 Counts the # of occurrences of a hex string.
Delete Block Shift DEL Moves the selected block to the block buffer.
DOS Shell Alt D Goes to DOS.
Edit Another File Alt E Opens a different file for editing.
Edit Translation Tabl Alt F8 Displays the translation table for editing.
Find Next F4 Finds next occurrence of search string.
Find Previous Shift F4 Finds previous occurrence of search string.
Goto File Offset Alt G Jumps to to given file offset
Help F1 Displays help screens.
Import File Alt I Inserts the contents of the specified file.
Insert Block Shift INS Inserts the contents of the block buffer.
Move n Bytes Ctrl R/L Moves the cursor up or down a number of bytes.
Arrow
Play Macro Alt 0-9 Plays macros 0 through 9.
Print All Alt P Prints entire file.
Print Block Alt L Prints selected block.
Quit Alt X Quits without saving.
Record/End Macro Alt Q Starts and stops macro recording.
Remove Block Markers Alt R Unselects block.
Repeat Last Byte F8 Repeats last byte insert/change
Replace ASCII String Alt F3 Searches for and replaces an ASCII string.
Replace Hex String F3 Searches for and replaces a hex string.
Save and Quit Alt Z Saves file and quits.
Save As Alt A Saves file under specified name.
Save File Alt S Saves file and continues.
Search for ASCII Str Alt F2 Searches for a string entered in ASCII format.
Search for Hex Str F2 Searches for a string entered in hex format.
Set Block Marker Alt B Sets and moves block start and end.
Set Bytes (ASCII) Alt F11 Sets all bytes in the selected block to the
specified ASCII character.
Set Bytes (Hex) F11 Sets all bytes in the selected block to the
specified hex value.
Set File Mode Alt M Sets the current file's read/write mode.
Set File Hidden Attr Alt H Sets the current file's hidden attribute.
Set Num Bytes to Move Alt N Sets the number of bytes to move when Ctrl
R/L Arrow is pressed.
Show Directory F7 When in file name fields displays directory.
Toggle Field Alt T Toggles between hex and ASCII fields
Togl Ins/Ovrtype mode Insert Toggles between Insert and Overtype modes.
Translate File Ctrl F8 Translates all bytes in the block or file
according to the translation table.
Truncate File F10 Truncates the file after the current offset.
Undo Alt U Undoes last change/insert/delete.